home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr46 / strx221.zip / BCSTR.H < prev    next >
Text File  |  1993-03-17  |  2KB  |  64 lines

  1. //
  2. // BCstr.h -- Borland object-based str interface
  3. // Author  : Roy S. Woll
  4. //
  5. // Copyright (c) 1993 by Roy S. Woll
  6. // You may distribute this source freely as long as you leave all files
  7. // in their original form, including the copyright notice as is.
  8. //
  9. // Version 1.00     10/20/92
  10. //
  11.  
  12. #ifndef _BCSTR_H
  13. #define _BCSTR_H
  14.  
  15.  
  16. #ifndef __SORTABLE_H
  17. #include <sortable.h>
  18. #endif
  19.  
  20. #ifndef _STR_H
  21. #include "str.h"
  22. #endif
  23.  
  24.  
  25. //
  26. // Base class Sortable is a protected base class to prevent
  27. // ambiguities where Object and str define the same member function
  28. // or operator (ie. operator !=).
  29. //
  30. class BCstr : protected Sortable, public str{
  31.  
  32. protected:
  33. //
  34. // Required functions for Base Class Object
  35. //
  36.     virtual int isEqual( const Object & ) const;
  37.     virtual int isLessThan( const Object & ) const;
  38.     virtual classType isA() const { return __firstUserClass; };
  39.     virtual char *nameOf() const { return "str"; };
  40.     virtual hashValueType hashValue() const;
  41.     virtual void printOn( ostream& ) const;
  42.  
  43. public:
  44.  
  45. //
  46. // Constructors
  47. //
  48.    BCstr(void);
  49.    BCstr(int p_bufsize, int  p_incr=STR_DEFAULT_MEMINCR);
  50.    BCstr(const char * s, int p_bufsize=0, int p_incr=STR_DEFAULT_MEMINCR);
  51.    BCstr(const BCstr&, int p_bufsize=0, int p_incr=STR_DEFAULT_MEMINCR);
  52.    BCstr(const str&, int p_bufsize=0, int p_incr=STR_DEFAULT_MEMINCR);
  53.  
  54.    operator Object&(void){ return *(Object*)this; };
  55.  
  56.    str& operator = (const BCstr& s){ return str::operator =(s);};
  57.    str& operator = (const str& s){ return str::operator =(s);};
  58.    str& operator = (const char * s){ return str::operator =(s);};
  59.    str& operator = (const char s){ return str::operator =(s);};
  60. };
  61.  
  62.  
  63. #endif
  64.